package asapIs134CK.womi.client;

import asapIs134CK.womi.client.games.PickUpHandler;
import asapIs134CK.womi.client.games.PickupEvent;
import asapIs134CK.womi.client.games.logoGame.froggitTheFrog.FroggitPickerWidget;
import asapIs134CK.womi.client.games.logoGame.froggitTheFrog.FroggitWidgetsFactory;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class FroggitLoader implements EntryPoint {

	@Override
	public void onModuleLoad() {
		
		final FroggitPickerWidget picker = new FroggitPickerWidget();
		picker.addPickupHandler(new PickUpHandler() {
			
			@Override
			public void onPickup(PickupEvent evt) {
				FroggitWidgetsFactory fact = (FroggitWidgetsFactory) evt.getPickedUp();
				RootPanel.get("content").remove(picker);
				RootPanel.get("content").add(fact.createGameWidget());
			}
		});
		RootPanel.get("content").add(picker);
	}

}
